package net.towee.client;

import net.towee.client.com.app.AppController;
import net.towee.client.com.app.ConnectionController;
import net.towee.client.com.app.RememberForm;
import net.towee.client.com.app.TopPanel;
import net.towee.client.com.app.UserFeedback;
import net.towee.client.com.app.presenter.ConnectionControllerPresenter;
import net.towee.client.com.app.presenter.RememberFormPresenter;
import net.towee.client.com.app.presenter.TopPanelPresenter;
import net.towee.client.com.app.presenter.UserFeedbackPresenter;
import net.towee.client.com.app.view.AppView;
import net.towee.client.com.app.view.ConnectionControllerView;
import net.towee.client.com.app.view.RememberFormView;
import net.towee.client.com.app.view.TopPanelView;
import net.towee.client.com.app.view.UserFeedbackView;
import net.towee.client.history.HistoryManager;
import net.towee.client.managers.AccountHelper;
import net.towee.client.managers.AccountsManager;
import net.towee.client.managers.AttachmentsManager;
import net.towee.client.managers.ContactsManager;
import net.towee.client.managers.DashBoardManager;
import net.towee.client.managers.DiscussionManager;
import net.towee.client.managers.DocumentsManager;
import net.towee.client.managers.GroupsManager;
import net.towee.client.managers.NodesManager;
import net.towee.client.managers.RolesManager;
import net.towee.client.managers.impl.AccountHelperImpl;
import net.towee.client.managers.impl.AccountsManagerImpl;
import net.towee.client.managers.impl.AttachmentsManagerImpl;
import net.towee.client.managers.impl.ContactsManagerImpl;
import net.towee.client.managers.impl.DashBoardManagerImpl;
import net.towee.client.managers.impl.DiscussionManagerImpl;
import net.towee.client.managers.impl.DocumentsManagerImpl;
import net.towee.client.managers.impl.GroupsManagerImpl;
import net.towee.client.managers.impl.NodesManagerImpl;
import net.towee.client.managers.impl.RolesManagerImpl;
import net.towee.client.widgets.upload.UploadForm;
import net.towee.client.widgets.upload.impl.UploadFormProvider;
import net.towee.server.rpc.services.ToweeServiceAsync;

import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.inject.client.AbstractGinModule;
import com.google.inject.Singleton;

public class ToweeMainModule extends AbstractGinModule {
	@Override
	protected void configure() {
		bind(ToweeServiceAsync.class).in(Singleton.class);
		bind(ToweeGinjector.class).in(Singleton.class);
		bind(HandlerManager.class).toProvider(HandlerManagerProvider.class).in(Singleton.class);
		bind(HistoryManager.class).in(Singleton.class);
		
		// Data managers
		bind(AccountsManager.class).to(AccountsManagerImpl.class).in(Singleton.class);
		bind(AccountHelper.class).to(AccountHelperImpl.class).in(Singleton.class);
		bind(AttachmentsManager.class).to(AttachmentsManagerImpl.class).in(Singleton.class);
		bind(ContactsManager.class).to(ContactsManagerImpl.class).in(Singleton.class);
		bind(DashBoardManager.class).to(DashBoardManagerImpl.class).in(Singleton.class);
		bind(DiscussionManager.class).to(DiscussionManagerImpl.class).in(Singleton.class);
		bind(GroupsManager.class).to(GroupsManagerImpl.class).in(Singleton.class);
		bind(DocumentsManager.class).to(DocumentsManagerImpl.class).in(Singleton.class);
		bind(NodesManager.class).to(NodesManagerImpl.class).in(Singleton.class);
		bind(RolesManager.class).to(RolesManagerImpl.class).in(Singleton.class);
		
		// App
		bind(AppController.Display.class).to(AppView.class).in(Singleton.class);
		bind(ConnectionController.class).to(ConnectionControllerPresenter.class).in(Singleton.class);
		bind(ConnectionControllerPresenter.Display.class).to(ConnectionControllerView.class).in(Singleton.class);
		bind(TopPanel.class).to(TopPanelPresenter.class).in(Singleton.class);
		bind(TopPanelPresenter.Display.class).to(TopPanelView.class).in(Singleton.class);
		
		// Upload form selector
		bind(UploadForm.class).toProvider(UploadFormProvider.class);
		
		// User feedback
		bind(UserFeedback.class).to(UserFeedbackPresenter.class);
		bind(UserFeedbackPresenter.Display.class).to(UserFeedbackView.class);
		
		// Remember me form
		bind(RememberForm.class).to(RememberFormPresenter.class).in(Singleton.class);
		bind(RememberFormPresenter.Display.class).to(RememberFormView.class).in(Singleton.class);
	}

}